package com.senthink.gl.business.messages;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component;

/**
 * @author Ethan
 * @date 2017/11/16
 */
@Component
public class CodeMsg {

    @Autowired
    private MessageSource messageSource;

    /**
     * 成功Code
     *
     * @return integer
     */
    public Integer successCode() {
        return Integer.valueOf(message("response.success.code"));
    }

    /**
     * 成功Msg
     *
     * @return string
     */
    public String successMsg() {
        return message("response.success.msg");
    }

    /**
     * 失败Code
     *
     * @return string
     */
    public Integer failureCode() {
        return Integer.valueOf(message("response.failure.code"));
    }

    /**
     * 失败msg
     *
     * @return string
     */
    public String failureMsg() {
        return message("response.failure.msg");
    }

    /**
     * 用户存在code
     *
     * @return integer
     */
    public Integer userExistCode() {
        return Integer.valueOf(message("response.userExist.code"));
    }

    /**
     * 用户存在msg
     *
     * @return string
     */
    public String userExistMsg() {
        return message("response.userExist.msg");
    }

    /**
     * 名字存在code
     *
     * @return integer
     */
    public Integer nameExistCode() {
        return Integer.valueOf(message("response.nameExist.code"));
    }

    /**
     * 用户存在msg
     *
     * @return string
     */
    public String nameExistMsg() {
        return message("response.nameExist.msg");
    }

    /**
     * 主题存在code
     *
     * @return integer
     */
    public Integer themeExistCode() {
        return Integer.valueOf(message("response.themeExist.code"));
    }

    /**
     * 主题存在msg
     *
     * @return string
     */
    public String themeExistMsg() {
        return message("response.themeExist.msg");
    }

    /**
     * 时间段重叠code
     *
     * @return integer
     */
    public Integer timeOverlapCode() {
        return Integer.valueOf(message("response.timeOverlap.code"));
    }

    /**
     * 时间段重叠msg
     *
     * @return string
     */
    public String timeOverlapMsg() {
        return message("response.timeOverlap.msg");
    }

    /**
     * 工单存在code
     *
     * @return integer
     */
    public Integer orderExistCode() {
        return Integer.valueOf(message("response.orderExist.code"));
    }

    /**
     * 工单存在msg
     *
     * @return string
     */
    public String orderExistMsg() {
        return message("response.orderExist.msg");
    }

    /**
     * 编号存在code
     *
     * @return integer
     */
    public Integer snExistCode() {
        return Integer.valueOf(message("response.snExist.code"));
    }

    /**
     * 编号存在msg
     *
     * @return string
     */
    public String snExistMsg() {
        return message("response.snExist.msg");
    }

    /**
     * 编号不存在code
     *
     * @return integer
     */
    public Integer snNotExistCode() {
        return Integer.valueOf(message("response.snNotExist.code"));
    }

    /**
     * 编号不存在msg
     *
     * @return string
     */
    public String snNotExistMsg() {
        return message("response.snNotExist.msg");
    }

    /**
     * 编号重复code
     *
     * @return integer
     */
    public Integer snDuplicatedCode() {
        return Integer.valueOf(message("response.snDuplicated.code"));
    }

    /**
     * 编号重复msg
     *
     * @return string
     */
    public String snDuplicatedMsg() {
        return message("response.snDuplicated.msg");
    }

    /**
     * 灯杆重复code(绑定了相同的灯杆)
     *
     * @return integer
     */
    public Integer lightPoleDuplicatedCode() {
        return Integer.valueOf(message("response.lightPoleDuplicated.code"));
    }

    /**
     * 灯杆重复msg(绑定了相同的灯杆)
     *
     * @return string
     */
    public String lightPoleDuplicatedMsg() {
        return message("response.lightPoleDuplicated.msg");
    }

    /**
     * 计量插座ID存在code
     *
     * @return integer
     */
    public Integer measureSocketIdExistCode() {
        return Integer.valueOf(message("response.measureSocketIdExist.code"));
    }

    /**
     * 计量插座ID存在msg
     *
     * @return string
     */
    public String measureSocketIdExistMsg() {
        return message("response.measureSocketIdExist.msg");
    }

    /**
     * 计量插座ID重复code
     *
     * @return integer
     */
    public Integer measureSocketIdDuplicatedCode() {
        return Integer.valueOf(message("response.measureSocketIdDuplicated.code"));
    }

    /**
     * 计量插座ID重复msg
     *
     * @return string
     */
    public String measureSocketIdDuplicatedMsg() {
        return message("response.measureSocketIdDuplicated.msg");
    }

    /**
     * 计量插座ID长度不合适code
     *
     * @return integer
     */
    public Integer measureSocketIdLengthCode() {
        return Integer.valueOf(message("response.measureSocketIdLength.code"));
    }

    /**
     * 计量插座ID长度不合适msg
     *
     * @return string
     */
    public String measureSocketIdLengthMsg() {
        return message("response.measureSocketIdLength.msg");
    }

    /**
     * 数据库访问异常code
     *
     * @return integer
     */
    public Integer dataAccessExceptionCode() {
        return Integer.valueOf(message("response.dataAccessException.code"));
    }

    /**
     * 数据库访问异常msg
     *
     * @return string
     */
    public String dataAccessExceptionMsg() {
        return message("response.dataAccessException.msg");
    }

    /**
     * 身份认证异常code
     *
     * @return integer
     */
    public Integer authenticationExceptionCode() {
        return Integer.valueOf(message("response.authenticationException.code"));
    }

    /**
     * 身份认证异常code
     *
     * @return string
     */
    public String authenticationExceptionMsg() {
        return message("response.authenticationException.msg");
    }

    /**
     * 非法参数code
     *
     * @return integer
     */
    public Integer illegalArgumentCode() {
        return Integer.valueOf(message("response.illegalArgument.code"));
    }

    /**
     * 非法参数msg
     *
     * @return string
     */
    public String illegalArgumentMsg() {
        return message("response.illegalArgument.msg");
    }

    /**
     * 参数校验异常code
     *
     * @return integer
     */
    public Integer bindExceptionCode() {
        return Integer.valueOf(message("response.bindException.code"));
    }

    /**
     * 参数校验异常msg
     *
     * @return string
     */
    public String bindExceptionMsg() {
        return message("response.bindException.msg");
    }

    /**
     * 方法参数校验异常code
     *
     * @return integer
     */
    public Integer methodArgumentCode() {
        return Integer.valueOf(message("response.methodArgument.code"));
    }

    /**
     * 方法参数校验异常msg
     *
     * @return string
     */
    public String methodArgumentMsg() {
        return message("response.methodArgument.msg");
    }

    /**
     * Token校验错误code
     *
     * @return integer
     */
    public Integer tokenErrorCode() {
        return Integer.valueOf(message("response.tokenError.code"));
    }

    /**
     * Token校验错误msg
     *
     * @return string
     */
    public String tokenErrorMsg() {
        return message("response.tokenError.msg");
    }

    /**
     * 登录用户名或密码错误code
     *
     * @return
     */
    public Integer accountErrorCode() {
        return Integer.valueOf(message("response.accountError.code"));
    }

    /**
     * 登录用户名或密码错误msg
     *
     * @return
     */
    public String accountErrorMsg() {
        return message("response.accountError.msg");
    }

    /**
     * 用户不存在code
     *
     * @return
     */
    public Integer accountNotExistCode() {
        return Integer.valueOf(message("response.accountNotExist.code"));
    }

    /**
     * 用户不存在msg
     *
     * @return
     */
    public String accountNotExistMsg() {
        return message("response.accountNotExist.msg");
    }

    /**
     * 指定记录不存在code(用于提交了非法ID的情况)
     *
     * @return
     */
    public Integer recordNotFoundCode() {
        return Integer.valueOf(message("response.recordNotFound.code"));
    }

    /**
     * 指定记录不存在msg(用于提交了非法ID的情况)
     *
     * @return
     */
    public String recordNotFoundMsg() {
        return message("response.recordNotFound.msg");
    }

    /**
     * 区域不存在code
     *
     * @return
     */
    public Integer areaNotExistCode() {
        return Integer.valueOf(message("response.areaNotExist.code"));
    }

    /**
     * 区域不存在msg
     *
     * @return
     */
    public String areaNotExistMsg() {
        return message("response.areaNotExist.msg");
    }

    /**
     * 网关不存在code
     *
     * @return
     */
    public Integer gatewayNotExistCode() {
        return Integer.valueOf(message("response.gatewayNotExist.code"));
    }

    /**
     * 网关不存在msg
     *
     * @return
     */
    public String gatewayNotExistMsg() {
        return message("response.gatewayNotExist.msg");
    }

    /**
     * 灯杆不存在code
     *
     * @return
     */
    public Integer lightPoleNotExistCode() {
        return Integer.valueOf(message("response.lightPoleNotExist.code"));
    }

    /**
     * 灯杆不存在msg
     *
     * @return
     */
    public String lightPoleNotExistMsg() {
        return message("response.lightPoleNotExist.msg");
    }

    /**
     * 实体数量超过限制code
     *
     * @return
     */
    public Integer tooManyEntityCode() {
        return Integer.valueOf(message("response.tooManyEntity.code"));
    }

    /**
     * 实体数量超过限制msg
     *
     * @return
     */
    public String tooManyEntityMsg() {
        return message("response.tooManyEntity.msg");
    }

    /**
     * 绑定的设备存在code
     *
     * @return
     */
    public Integer bindingDeviceNotExistCode() {
        return Integer.valueOf(message("response.bindingDeviceNotExist.code"));
    }

    /**
     * 绑定的设备不存在msg
     *
     * @return
     */
    public String bindingDeviceNotExistMsg() {
        return message("response.bindingDeviceNotExist.msg");
    }

    /**
     * 策略不存在code
     *
     * @return
     */
    public Integer strategyNotExistCode() {
        return Integer.valueOf(message("response.strategyNotExist.code"));
    }

    /**
     * 策略不存在msg
     *
     * @return
     */
    public String strategyNotExistMsg() {
        return message("response.strategyNotExist.msg");
    }

    /**
     * 不完整的表格code(必填参数没有填完整)
     *
     * @return
     */
    public Integer incompleteExcelCode() {
        return Integer.valueOf(message("response.incompleteExcel.code"));
    }

    /**
     * 不完整的表格msg(必填参数没有填完整)
     *
     * @return
     */
    public String incompleteExcelMsg() {
        return message("response.incompleteExcel.msg");
    }

    /**
     * 导入文件中有错误设备类型code
     *
     * @return
     */
    public Integer sensorTypeErrorCode() {
        return Integer.valueOf(message("response.sensorTypeError.code"));
    }

    /**
     * 导入文件中有错误设备类型msg
     *
     * @return
     */
    public String sensorTypeErrorMsg() {
        return message("response.sensorTypeError.msg");
    }

    /**
     * 策略正在使用code(企图删除正在使用的策略)
     *
     * @return
     */
    public Integer policiesIsInUseCode() {
        return Integer.valueOf(message("response.policiesIsInUse.code"));
    }

    /**
     * 策略正在使用msg(企图删除正在使用的策略)
     *
     * @return
     */
    public String policiesIsInUseMsg() {
        return message("response.policiesIsInUse.msg");
    }

    /**
     * 同一根灯杆绑定了相同类型的传感设备code
     *
     * @return
     */
    public Integer sensorTypeExistCode() {
        return Integer.valueOf(message("response.sensorTypeExist.code"));
    }

    /**
     * 同一跟灯杆绑定了相同类型的传感设备msg
     *
     * @return
     */
    public String sensorTypeExistMsg() {
        return message("response.sensorTypeExist.msg");
    }

    /**
     * 同一个采集器上绑定了相同地址的传感设备code
     *
     * @return
     */
    public Integer sameAddressCode() {
        return Integer.valueOf(message("response.sameAddress.code"));
    }

    /**
     * 同一个采集器上绑定了相同地址的传感设备msg
     *
     * @return
     */
    public String sameAddressMsg() {
        return message("response.sameAddress.msg");
    }

    /**
     * 同一根灯杆上存在摄像头设备Code
     *
     * @return
     */
    public Integer webInSameLightPoleCode() {
        return Integer.valueOf(message("response.webInSameLightPole.code"));
    }

    /**
     * 同一根灯杆上存在摄像头设备Msg
     *
     * @return
     */
    public String webInSameLightPoleMsg() {
        return message("response.webInSameLightPole.msg");
    }

    /**
     * 号码错误Code
     *
     * @return
     */
    public Integer phoneNumberErrorCode() {
        return Integer.valueOf(message("response.phoneNumberError.code"));
    }

    /**
     * 同一根灯杆上存在RFID读卡器设备Code
     *
     * @return
     */
    public Integer rfidReaderInSameLightPoleCode() {
        return Integer.valueOf(message("response.rfidReaderInSameLightPole.code"));
    }

    /**
     * 同一根灯杆上存在RFID读卡器设备Msg
     *
     * @return
     */
    public String rfidReaderInSameLightPoleMsg() {
        return message("response.rfidReaderInSameLightPole.msg");
    }

    /**
     * 号码错误Msg
     *
     * @return
     */
    public String phoneNumberErrorMsg() {
        return message("response.phoneNumberError.msg");
    }

    /**
     * 号码错误Code
     *
     * @return
     */
    public Integer isUsingCode() {
        return Integer.valueOf(message("response.isUsing.code"));
    }

    /**
     * 号码错误Msg
     *
     * @return
     */
    public String isUsingMsg() {
        return message("response.isUsing.msg");
    }

    /**
     * 获取验证码过快Code
     *
     * @return Integer
     */
    public Integer verCodeTooFastCode() {
        return Integer.valueOf(message("response.verCodeTooFast.code"));
    }

    /**
     * 获取验证码过快Msg
     *
     * @return String
     */
    public String verCodeTooFastMsg() {
        return message("response.verCodeTooFast.msg");
    }

    /**
     * 发送邮件失败 Code
     *
     * @return Integer
     */
    public Integer emailFailureCode() {
        return Integer.valueOf(message("response.emailFailure.code"));
    }

    /**
     * 发送邮件失败 Msg
     *
     * @return String
     */
    public String emailFailureMsg() {
        return message("response.emailFailure.msg");
    }

    /**
     * 发送短信失败 Code
     *
     * @return Integer
     */
    public Integer smsFailureCode() {
        return Integer.valueOf(message("response.smsFailure.code"));
    }

    /**
     * 发送短信失败 Msg
     *
     * @return String
     */
    public String smsFailureMsg() {
        return message("response.smsFailure.msg");
    }

    /**
     * 验证码不存在 Code
     *
     * @return Integer
     */
    public Integer smsNoCodeCode() {
        return Integer.valueOf(message("response.smsNoCode.code"));
    }

    /**
     * 验证码不存在 Msg
     *
     * @return String
     */
    public String smsNoCodeMsg() {
        return message("response.smsNoCode.msg");
    }

    /**
     * 验证码错误 Code
     *
     * @return Integer
     */
    public Integer smsCodeErrorCode() {
        return Integer.valueOf(message("response.smsCodeError.code"));
    }

    /**
     * 验证码错误 Msg
     *
     * @return String
     */
    public String smsCodeErrorMsg() {
        return message("response.smsCodeError.msg");
    }

    /**
     * 验证码过期 Code
     *
     * @return Integer
     */
    public Integer smsCodeExpiredCode() {
        return Integer.valueOf(message("response.smsCodeExpired.code"));
    }

    /**
     * 验证码过期 Msg
     *
     * @return String
     */
    public String smsCodeExpiredMsg() {
        return message("response.smsCodeExpired.msg");
    }

    /**
     * 图形验证码错误 Code
     *
     * @return
     */
    public Integer verCodeErrorCode() {
        return Integer.valueOf(message("response.verCodeError.code"));
    }

    /**
     * 图形验证码错误 Msg
     *
     * @return
     */
    public String verCodeErrorMsg() {
        return message("response.verCodeError.msg");
    }

    /**
     * 图形验证码失效 Code
     *
     * @return
     */
    public Integer verCodeExpiredCode() {
        return Integer.valueOf(message("response.verCodeExpired.code"));
    }

    /**
     * 图形验证码失效 Msg
     *
     * @return
     */
    public String verCodeExpiredMsg() {
        return message("response.verCodeExpired.msg");
    }

    /**
     * 忘记密码次数达到限制 Code
     *
     * @return
     */
    public Integer resetPwMaxCountCode() {
        return Integer.valueOf(message("response.resetPwMaxCount.code"));
    }

    /**
     * 忘记密码次数达到限制 Msg
     *
     * @return
     */
    public String resetPwMaxCountMsg() {
        return message("response.resetPwMaxCount.msg");
    }

    /**
     * 其他系统中系统名或url重复 Code
     *
     * @return
     */
    public Integer otherSystemParamErrorCode() {
        return Integer.valueOf(message("response.otherSystemParamError.code"));
    }

    /**
     * 其他系统中系统名或url重复 Msg
     *
     * @return
     */
    public String otherSystemParamErrorMsg() {
        return message("response.otherSystemParamError.msg");
    }

    /**
     * 设备故障等级存在code
     *
     * @return integer
     */
    public Integer faultLevelExistCode() {
        return Integer.valueOf(message("response.faultLevelExist.code"));
    }

    /**
     * 设备故障等级存在msg
     *
     * @return string
     */
    public String faultLevelExistMsg() {
        return message("response.faultLevelExist.msg");
    }

    /**
     * 设备故障类型存在code
     *
     * @return integer
     */
    public Integer faultTypeExistCode() {
        return Integer.valueOf(message("response.faultTypeExist.code"));
    }

    /**
     * 设备故障类型存在msg
     *
     * @return string
     */
    public String faultTypeExistMsg() {
        return message("response.faultTypeExist.msg");
    }

    /**
     * 策略参数值错误code
     *
     * @return Integer
     */
    public Integer paramValueErrorCode() {
        return Integer.valueOf(message("response.policiesParamValueError.code"));
    }

    /**
     * 策略参数值错误msg
     *
     * @return String
     */
    public String paramValueErrorMsg() {
        return message("response.policiesParamValueError.msg");
    }

    /**
     * 策略参数等级已经存在code
     *
     * @return Integer
     */
    public Integer paramLevelExistCode() {
        return Integer.valueOf(message("response.paramLevelExist.code"));
    }

    /**
     * 策略参数等级已经存在msg
     *
     * @return String
     */
    public String paramLevelExistMsg() {
        return message("response.paramLevelExist.msg");
    }

    /**
     * 读取message
     *
     * @param key key
     * @return string
     */
    private String message(String key) {
        return messageSource.getMessage(key, null, LocaleContextHolder.getLocale());
    }

    /**
     * 名称或卡号已存在在msg
     *
     * @return string
     */
    public String nameORcardNoExistMsg() {
        return message("response.nameORcardNoExist.msg");
    }

    /**
     * 名称或卡号已存在在msg
     *
     * @return string
     */
    public String deveuiExistMsg() {
        return message("response.imeiNoExist.msg");
    }

    /**
     * 账号已存在在msg
     *
     * @return string
     */
    public String accountExistMsg() {
        return message("response.accountExist.msg");
    }

    /**
     * 手机号已存在在msg
     *
     * @return string
     */
    public String phoneExistMsg() {
        return message("response.phoneExist.msg");
    }

    /**
     * 邮箱已存在在msg
     *
     * @return string
     */
    public String emailExistMsg() {
        return message("response.emailExist.msg");
    }

    /**
     * 短信通知已存在Code
     *
     * @return integer
     */
    public Integer orderNotifyCode() {
        return Integer.valueOf(message("response.orderNotify.code"));
    }

    /**
     * 短信通知已存在Msg
     *
     * @return string
     */
    public String orderNotifyMsg() {
        return message("response.orderNotify.msg");
    }

}
